package com.mlink.ai.chat.ui.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.mlink.ai.chat.utils.LanguageUtils

abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
    protected lateinit var binding: VB
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        if (LanguageUtils.isLanguageSet()) {
            LanguageUtils.changeLanguage(
                this,
                LanguageUtils.getCurrentLanguageCode()!!,
                false
            )
        }
        //ViewBinding
        binding = getViewBinding()
        setContentView(binding.root)
        //初始化View
        initViews()
    }

    abstract fun getViewBinding(): VB
    abstract fun initViews()
}
